package com.bbdjt.weixin.service.impl;

import java.util.List;


import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;
import tk.mybatis.mapper.util.StringUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.bbdjt.weixin.model.BespokeQueryModel;
import com.bbdjt.weixin.base.service.impl.BaseServiceImpl;
import com.bbdjt.weixin.dao.BespokeDao;
import com.bbdjt.weixin.model.Bespoke;
import com.bbdjt.weixin.service.BespokeService;

@Service("bespokeService")
public class BespokeServiceImpl extends BaseServiceImpl<Bespoke> implements BespokeService {
	
	@Override
    public List<Bespoke> selectByBespoke(Bespoke bespoke, int page, int rows) {
        Example example = new Example(Bespoke.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo(bespoke);
        PageHelper.startPage(page, rows);
        return selectByExample(example);
    }
    
    @Override
    public List<Bespoke> selectByBespoke(Bespoke bespoke) {
        Example example = new Example(Bespoke.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo(bespoke);
        return selectByExample(example);
    }

    @Override
    public PageInfo<BespokeQueryModel> selectByBespokeQueryModel(BespokeQueryModel bespoke) {
    	return ((BespokeDao) getMapper()).selectByBespokeModel(bespoke);
    }

	@Override
	public List<Bespoke> selectByBespoke(BespokeQueryModel bespoke) {
		  Example example = new Example(Bespoke.class);
	        Example.Criteria criteria = example.createCriteria();
	        criteria.andEqualTo(bespoke);
	        PageHelper.startPage(bespoke.getPageNum(), bespoke.getPageSize(),bespoke.getOrderBy());
	        return selectByExample(example);
	}

	@Override
	public List<Bespoke> selectBespokeList(Bespoke bespoke) {
		return ((BespokeDao) getMapper()).selectBespokeList(bespoke);
	}

	
}